<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-do-edit" th:object="${tbReserve}">
        <input type="hidden" name="id" th:value="*{id}"><!-- 主键 -->
        <div class="form-group">
            <label class="col-sm-3 control-label">专家:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="expertName" th:value="*{expertName}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">咨询者:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="questioner" th:value="*{questioner}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">面积:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="area" th:value="*{area}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">土地地址:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="address" th:value="*{address}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">农作物名称:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="plantName" th:value="*{plantName}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">土壤条件:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="soilCondition" th:value="*{soilCondition}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">作物条件:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="plantCondition" th:value="*{plantCondition}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">作物详细信息:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="plantDetail" th:value="*{plantDetail}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">作物详细信息:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="phone" th:value="*{phone}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">留言:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="message" th:value="*{message}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">回答:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="answer" th:value="*{answer}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="status" th:value="*{status}"></div>
        </div>
        <div class="form-group">
            <div class="form-control-static col-sm-offset-9">
                <button type="submit" class="btn btn-primary">提交</button>
                <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script type="text/javascript">
    layui.use('laydate', function () {
        var laydate = layui.laydate;//时间选择器
        laydate.render({
            elem: '#inDate', type: 'date'
        });
    });
    var prefix = "/tbReserve"
    $("#form-do-edit").validate({
        rules: {
            id: {required: true},
        },
        messages: {
            "id": {remote: "必填"}
        },
        submitHandler: function (form) {
            $.operate.save(prefix + "/editSave", dataEdit());
        }
    });

    function dataEdit() {
        var id = $("input[name='id']").val();
        var expertName = $("input[name='expertName']").val();
        var questioner = $("input[name='questioner']").val();
        var area = $("input[name='area']").val();
        var address = $("input[name='address']").val();
        var plantName = $("input[name='plantName']").val();
        var soilCondition = $("input[name='soilCondition']").val();
        var plantCondition = $("input[name='plantCondition']").val();
        var plantDetail = $("input[name='plantDetail']").val();
        var phone = $("input[name='phone']").val();
        var message = $("input[name='message']").val();
        var answer = $("input[name='answer']").val();
        var status = $("input[name='status']").val();
        return {
            "id":id,
            "expertName":expertName,
            "questioner":questioner,
            "area":area,
            "address":address,
            "plantName":plantName,
            "soilCondition":soilCondition,
            "plantCondition":plantCondition,
            "plantDetail":plantDetail,
            "phone":phone,
            "message":message,
            "answer":answer,
            "status":status,
        }
    }
</script>
</body>
</html>